package com.ruoyi.web.controller.tool.xml;

import java.util.ArrayList;
import java.util.List;

public class XmlGenerator {

    public static void main(String[] args) {
        // 模拟数据源
        List<Column> columns = new ArrayList<>();
        columns.add(new Column("PRDCDE","varchar",4,"产品码/业务类型"));
        columns.add(new Column("IBKNUM","varchar",4,"行号后四位"));
        columns.add(new Column("CRNYER","varchar",2,"年份"));
        columns.add(new Column("PDNSEQ","varchar",6,"序号"));
        columns.add(new Column("REFNUM","varchar",16,"汇入业务编号"));
        columns.add(new Column("ORINUM","varchar",16,"原汇入业务编号（退汇）"));
        columns.add(new Column("SNDBAK","varchar",5,"汇出行行号"));
        columns.add(new Column("RETABN","varchar",34,"汇出行名称"));
        columns.add(new Column("RCVBAK","varchar",5,"汇入行行号"));
        columns.add(new Column("BBKNAM","varchar",34,"汇入行名称"));
        columns.add(new Column("RETNAM","varchar",72,"汇款人名称"));
        columns.add(new Column("RETADR","varchar",70,"汇款人地址／电话"));
        columns.add(new Column("BENNAM","varchar",72,"收款人名称"));
        columns.add(new Column("BENADR","varchar",70,"收款人地址／电话"));
        columns.add(new Column("RMTUSE","varchar",2,"汇款用途"));
        columns.add(new Column("WKTYPE","varchar",1,"汇款性质"));
        columns.add(new Column("RMTATY","varchar",2,"汇款人交易账号类型"));
        columns.add(new Column("RMTFLG","varchar",1,"汇款人帐号标志"));
        columns.add(new Column("RMTOAC","varchar",34,"汇款人交易帐号"));
        columns.add(new Column("RMTSYS","varchar",1,"汇款人系统标志"));
        columns.add(new Column("RMTORG","varchar",3,"汇款人机构号"));
        columns.add(new Column("RMTCUS","varchar",7,"汇款人客户号"));
        columns.add(new Column("RMTAPC","varchar",4,"汇款人核算码"));
        columns.add(new Column("RMTCUR","varchar",3,"汇款人货币码"));
        columns.add(new Column("BENATY","varchar",2,"收款人交易账号类型"));
        columns.add(new Column("BENFLG","varchar",1,"收款账户标志"));
        columns.add(new Column("BENOAC","varchar",34,"收款人交易帐号"));
        columns.add(new Column("BENSYS","varchar",1,"收款人系统标志"));
        columns.add(new Column("BENORG","varchar",3,"收款人机构号"));
        columns.add(new Column("BENCUS","varchar",7,"收款人客户号"));
        columns.add(new Column("BENAPC","varchar",4,"收款人核算码"));
        columns.add(new Column("BENCUR","varchar",3,"收款人货币码"));
        columns.add(new Column("FEEATY","varchar",2,"费用人交易账号类型"));
        columns.add(new Column("FEEFLG","varchar",1,"费用帐号标志"));
        columns.add(new Column("FEEOAC","varchar",34,"费用帐号"));
        columns.add(new Column("FEESYS","varchar",1,"费用账户系统标记"));
        columns.add(new Column("FEEORG","varchar",3,"机构号"));
        columns.add(new Column("FEECUS","varchar",7,"客户号"));
        columns.add(new Column("FEEAPC","varchar",4,"核算码"));
        columns.add(new Column("FEECUR","varchar",3,"货币码"));
        columns.add(new Column("RETAMT","number",15,"汇款金额"));
        columns.add(new Column("CUSAM1","number",15,"汇款账号实际支出金额"));
        columns.add(new Column("RMTFEE","number",15,"电子汇划费"));
        columns.add(new Column("COMFEE","number",15,"手续费"));
        columns.add(new Column("MALFEE","number",15,"邮电费"));
        columns.add(new Column("ORGIDT","varchar",3,"经办柜员机构号"));
        columns.add(new Column("TLRNUM","varchar",4,"经办柜员号"));
        columns.add(new Column("VCHSET","number",4,"当天传票套号"));
        columns.add(new Column("DEPNUM","varchar",2,"经办柜员所属部门"));
        columns.add(new Column("MODTLR","varchar",4,"修改柜员号"));
        columns.add(new Column("MODDAT","date",17,"经办修改日期"));
        columns.add(new Column("HDLGRP","varchar",2,"经办柜组"));
        columns.add(new Column("HDLDAT","date",17,"经办日期"));
        columns.add(new Column("HDLTIM","varchar",8,"经办时间"));
        columns.add(new Column("CHKTLR","varchar",4,"复核柜员号"));
        columns.add(new Column("CHKDAT","date",17,"复核日期"));
        columns.add(new Column("CHKTIM","varchar",8,"复核时间"));
        columns.add(new Column("AUTTLR","varchar",4,"授权柜员号"));
        columns.add(new Column("ATHDAT","date",17,"授权日期"));
        columns.add(new Column("ATHTIM","varchar",8,"授权时间"));
        columns.add(new Column("VALDAT","date",17,"起息日"));
        columns.add(new Column("HANDAT","date",17,"挂账日期"));
        columns.add(new Column("CCLDAT","date",17,"转销日期"));
        columns.add(new Column("FEEMDE","varchar",1,"扣费方式"));
        columns.add(new Column("CSHTYP","varchar",1,"钞汇类型"));
        columns.add(new Column("RATVA1","number",20,"汇出货币对应当日卖出价"));
        columns.add(new Column("RATVA2","number",20,"收费货币对应当日买入价"));
        columns.add(new Column("RETREF","varchar",210,"备注"));
        columns.add(new Column("ANACDE","varchar",4,"统计分析码"));
        columns.add(new Column("BATFEE","varchar",1,"是否批量收费"));
        columns.add(new Column("RTMFLG","varchar",1,"汇款标志"));
        columns.add(new Column("RRMFLG","varchar",1,"退汇标志"));
        columns.add(new Column("FUNCDE","varchar",6,"调用交换平台功能码"));
        columns.add(new Column("PNTTIM","number",4,"回单打印次数"));
        columns.add(new Column("ADJDAT","varchar",10,"调账日期（为实际记账日期）"));
        columns.add(new Column("ADJTLR","varchar",4,"错账调整柜员"));
        columns.add(new Column("ATVORG","varchar",3,"柜员机构号"));
        columns.add(new Column("ATVTLR","varchar",4,"柜员号"));
        columns.add(new Column("ATVSET","number",4,"传票套号"));
        columns.add(new Column("RETSTS","varchar",1,"记录状态"));
        columns.add(new Column("RMTPTY","varchar",1,"汇款帐户支票类型"));
        columns.add(new Column("RMTPAP","varchar",10,"汇款帐户支票号"));
        columns.add(new Column("FEEPTY","varchar",1,"费用帐户支票类型"));
        columns.add(new Column("FEEPAP","varchar",10,"费用帐户支票号"));
        columns.add(new Column("RECSTS","varchar",1,"记录状态"));



        // 生成XML
        StringBuilder xmlBuilder = new StringBuilder();
        xmlBuilder.append("<columns>\n");

        for (Column column : columns) {
            xmlBuilder.append("    <column>\n");
            xmlBuilder.append("        <colname>").append(column.getColname()).append("</colname>\n");
            xmlBuilder.append("        <type>").append(column.getType()).append("</type>\n");
            xmlBuilder.append("        <length>").append(column.getLength()).append("</length>\n");
            xmlBuilder.append("        <colcomm>").append(column.getColcomm()).append("</colcomm>\n");
            xmlBuilder.append("    </column>\n");
        }

        xmlBuilder.append("</columns>");

        // 输出生成的XML
        System.out.println(xmlBuilder.toString());
    }
}
